<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class BakerysViewBilladdress extends JViewLegacy
{
	public function display($tpl = null) 
	{	
		$input = JFactory::getApplication()->input;
		$location_id = $input->get("location");
		$location_alias = $input->get("location_alias");
		$session = JFactory::getSession();
		$this->cart = $session->get("bakery_cart_".$location_id);
		
		if(!isset($this->cart)) 
		{
			$app = JFactory::getApplication();
			$link = JRoute::_("index.php?option=com_bakerys&view=bakerys&location=".$location_id.":".$location_alias);
			$app->redirect($link);
		}
		
		
		
		$guest_mail = JRequest::getVar("guest_mail");
		if(!empty($guest_mail))
		{
			$session->set("guest_mail",$guest_mail);	
		}
		
		$user = JFactory::getUser();
		if($user->id)
		{
			$model = $this->getModel();
			$this->user = $model->getUserInfo($user->id);
		}
		parent::display($tpl);		
	}
	
}
